package org.sensornet2010.co2sh.prototype;

import android.util.Log;

public class DummyAppSingleton {

	private static DummyAppSingleton _instance = null;
	
	private DummyAppSingleton(){
		
	}

	
	public static synchronized DummyAppSingleton getInstance(){
		if (DummyAppSingleton._instance == null) {
			DummyAppSingleton._instance = new DummyAppSingleton();
		}
		return DummyAppSingleton._instance;
	}
	
	
	
	//methods
	public void updateConfiguration(String serverUrl) {
		Log.v("updateConfiguration", "Server url configured!");
	}
	
	public void getServerState(String serverUrl){
		Log.v("getServerState", "Getting server state!");
	}
	
	public void sendData(Object data){
		Log.v("sendData", "Data sent!");
	}
	
	Object obj;
	public void recordAudio(int recordDuration, int recordInterval){
		Thread t = new Thread(new Runnable() {
			public void run() {
				try {
					while (true) {
						Log.v("recordAudio", "Recording audio!");
						Log.v("recordAudio", "Sleeping");
						Thread.sleep(5000);
						sendData(obj);
						Log.v("sendData", "Sending data");
						Log.v("Wait", "Waiting for next record");
						Thread.sleep(5000);
					}
				} catch (InterruptedException e) {
					e.printStackTrace();
				};
			}
		});
		t.start();
	}
}
